UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Guv9UQJ3p4xzlVtW955rgl7OiMxge9r1FoXuqBqY+vo=' 
WHERE 
  key_id = '6a201cb802d0b4eff679275703b775f0cb2b4190342675feb91258351acad590' 
  AND (
    token = 'Guv9UQJ3p4xzlVtW955rgl7OiMxge9r1FoXuqBqY+vo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035