UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CXUQ9KAk3NwpLR+u0eBsFxqXfmESGPZltv6L64BUmak='
WHERE
key_id = 'a8754791f15b744efd9a23ee8d6ea26944a2bf479f51b5b50c204ba0e0701a1e'
AND (
token = 'CXUQ9KAk3NwpLR+u0eBsFxqXfmESGPZltv6L64BUmak='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)