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