UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'FjK2OGII28AemLDWJJB5sUmUJiPjyFap6pMyFWK/wGo='
WHERE
key_id = 'd877d217d185933d1816431b9aa3320f8c9e0ed07b9b9a02a9751e45e44bf4d0'
AND (
token = 'FjK2OGII28AemLDWJJB5sUmUJiPjyFap6pMyFWK/wGo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)