UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sQrWfAYIxLJfSY6M08/p4fjetNCcUUS5j3FSUBw+Mv0='
WHERE
key_id = 'c5538b6db5b129da0ae97b07213737ee44f53ba5474cd973827754edae654b57'
AND (
token = 'sQrWfAYIxLJfSY6M08/p4fjetNCcUUS5j3FSUBw+Mv0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)