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