UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LRoAEnNzb+X/03GdV0gtZdetazKA+ZKzfsVRN6VOLKg=' 
WHERE 
  key_id = '6f2b275df8fcfaf681ceb071250f90e844cd5b899d16aed34e27e62b4559b6a2' 
  AND (
    token = 'LRoAEnNzb+X/03GdV0gtZdetazKA+ZKzfsVRN6VOLKg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026