UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XwT5ANhwdYeWCYD0tVCuxf8+NajTctRbliM7GDKTFyk='
WHERE
key_id = 'aff28b05326a66d96f4723429ae2de348020de0767fdbea8cbebeb21012bfc89'
AND (
token = 'XwT5ANhwdYeWCYD0tVCuxf8+NajTctRbliM7GDKTFyk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)