UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'd2XRZc6rqf36FY8SETxSn+d2AqUpzVLq92WlouOC1Ck=' 
WHERE 
  key_id = '5567dbee11b2d563a6de989773f96bfcde810c5c29ed7866e7d73a628a3aa513' 
  AND (
    token = 'd2XRZc6rqf36FY8SETxSn+d2AqUpzVLq92WlouOC1Ck=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034