UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AmlAmejzoSYwH4z0SfpDG6kryrjm21gJYdL01DocgFU='
WHERE
key_id = '83aef3cf71cdfc271a6b5094ba378dfc4fc7a944f320d822e007c1347fc2f434'
AND (
token = 'AmlAmejzoSYwH4z0SfpDG6kryrjm21gJYdL01DocgFU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)