UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'a8MS9VoZ3aPOh1cazeEQSi6whPDL/tKyfNses0FVWr8='
WHERE
key_id = '1456174c8110ec51b07d6340c6fdf21792b869f498bcc03efd148d42d26f774d'
AND (
token = 'a8MS9VoZ3aPOh1cazeEQSi6whPDL/tKyfNses0FVWr8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)