UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'LXegwnmDEeK4sdTWUZLLbqoogth+D0N+jxybMyFeu+k='
WHERE
key_id = 'ee59781a407c9ea3ae7bb99768450f16c47ecf8fc60f265e86c53572e18bfe31'
AND (
token = 'LXegwnmDEeK4sdTWUZLLbqoogth+D0N+jxybMyFeu+k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)