UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mWqcs6oHPA5btEW91BpFLLBKtpAadfiTyyfwxS9sR3E='
WHERE
key_id = 'e9b7526a1cdb73e94612e2233112c7817a8aac857036ce4317cd72704dd50bb1'
AND (
token = 'mWqcs6oHPA5btEW91BpFLLBKtpAadfiTyyfwxS9sR3E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)