UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8u97KdSEthmCOY8ezPctfXC+6ZrZFsii41d8KiSkV9c=' 
WHERE 
  key_id = '06d090a5c389c8b82564a95a096b2b0a322b2cac9a79e1bef1cf8eb86a28bf55' 
  AND (
    token = '8u97KdSEthmCOY8ezPctfXC+6ZrZFsii41d8KiSkV9c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032