UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'J+TohDQ6cZNEnbSfx/8XXVQl9JVWWJNrULSd5ATVRX8='
WHERE
key_id = '3edbd53a73ec716ce6bab936e16ae37db867ae8187116151a5d96ee6b3a1e27a'
AND (
token = 'J+TohDQ6cZNEnbSfx/8XXVQl9JVWWJNrULSd5ATVRX8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)