UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yI4Bo+oftRo9zu8G76ytLwic8a/pLX9X7Pqx+UjS1W8='
WHERE
key_id = 'f8ad6c8dc8a189d78f85f17a2b2b7016a035c1c2702553fdfe60d29c3deccea1'
AND (
token = 'yI4Bo+oftRo9zu8G76ytLwic8a/pLX9X7Pqx+UjS1W8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)