UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rEGcVd4qwEV2YXYW541KatqkI3xtZdGbjvEBPZX3JA4='
WHERE
key_id = '5828046e43a80431933c5f9d6bf64fae89251f11a9c83fec63ed7887d1d4d79c'
AND (
token = 'rEGcVd4qwEV2YXYW541KatqkI3xtZdGbjvEBPZX3JA4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)