UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Djj4QSZ0Wd+xTdZCB4bOMQYM2x6yBTdx4hGoOjf71PE='
WHERE
key_id = 'dc3c9c4c604025ea3ce62a4bd6fa801e1556a4ac3f36d7848deaa3f53e256cde'
AND (
token = 'Djj4QSZ0Wd+xTdZCB4bOMQYM2x6yBTdx4hGoOjf71PE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)