UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'chWywyZOf53RtG7/qWcW+jq8hfyqTiOwlNVMg834wWs='
WHERE
key_id = '21dba57c1da3be383c5434ceb36b74a3e4921c47e40b1c2a682a167d3bc5d751'
AND (
token = 'chWywyZOf53RtG7/qWcW+jq8hfyqTiOwlNVMg834wWs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)