UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QdHHsLhtgsFJ1VjHTDfykSSOfQLWnBXTWlAWTFznEJ0=' 
WHERE 
  key_id = '26c40486ddd4430227b50e4eb29d30c55bb2459187f802d77c0e5e3620fb2744' 
  AND (
    token = 'QdHHsLhtgsFJ1VjHTDfykSSOfQLWnBXTWlAWTFznEJ0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034