UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'R6bC31a1fCacnl1lTQjB/IGYry5pjSci6DitthAuBPE='
WHERE
key_id = '804a602727aaa5eec5f1389009ccd9fcdd73d681f6914b9d2033ab57122974a0'
AND (
token = 'R6bC31a1fCacnl1lTQjB/IGYry5pjSci6DitthAuBPE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)