UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4ggk65taCpA5k973IT+mn82xUx1BwbzNU1ryQuizT1w=' 
WHERE 
  key_id = '189ef336c4c70d5a48e971186b5935d1946a94a4c11574bb00131806cf95abed' 
  AND (
    token = '4ggk65taCpA5k973IT+mn82xUx1BwbzNU1ryQuizT1w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032