UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SoZP89s37OwEVcT4A/OkDC+fVzICCED5SMkMQTvj7vU='
WHERE
key_id = 'c4b275f3767089d6cf152c11174d96701da2b2fd4306aad56a66a0aa796a69c5'
AND (
token = 'SoZP89s37OwEVcT4A/OkDC+fVzICCED5SMkMQTvj7vU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)