UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oskk3WFKiQ0VT7gSKDPCfhKW6Tveqx2wf5SJXwvmeRo='
WHERE
key_id = 'c986817fb4157fd2d07f5c5c8fbac2ae60d8738bd52a762ba536484d5475eabb'
AND (
token = 'oskk3WFKiQ0VT7gSKDPCfhKW6Tveqx2wf5SJXwvmeRo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)