UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Z7WP9+s75fyG95VSs6W896pS9GXQZfcCER+kGi3Lovs='
WHERE
key_id = '252a1e8e28b7c531bdbd86051bea84c98c9554a0074cecd4bedf528d091ae2ad'
AND (
token = 'Z7WP9+s75fyG95VSs6W896pS9GXQZfcCER+kGi3Lovs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)