UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JxznLptKHQ05dwvexb5TDS3q8ij7NFxgjJPSxq5ajP8='
WHERE
key_id = '9b58e4835347a3188f2f39acff056dada3c2ebd21fbe6df157f2e207f5dd2603'
AND (
token = 'JxznLptKHQ05dwvexb5TDS3q8ij7NFxgjJPSxq5ajP8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)