UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'x7gKNQyFjUQCarZ6vdw57JjQ1fcRcanMCwutgJn0l7E='
WHERE
key_id = '348b435e8eb3c36724384df734d2fa6104b526784b072a2d334e9cc29308b751'
AND (
token = 'x7gKNQyFjUQCarZ6vdw57JjQ1fcRcanMCwutgJn0l7E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)