UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'a6bYUEnUomEpGsLexbj/n8muy+TtbNW204i6MH/rGYc=' 
WHERE 
  key_id = 'ecbcfa839ead4643b6faf8290abf718727ecd514959274da38c92c599eb25563' 
  AND (
    token = 'a6bYUEnUomEpGsLexbj/n8muy+TtbNW204i6MH/rGYc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053