UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KWyK+uGRBjCGPZvwbPYLRn0QL9S83T9ZUJSBskRnrPg='
WHERE
key_id = 'dd86c6c2f9727406d8ba6bc5ba6de193208644a717ef57837ecb790b173b1b2b'
AND (
token = 'KWyK+uGRBjCGPZvwbPYLRn0QL9S83T9ZUJSBskRnrPg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)