UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+WI6+3OkkB0pPmNsvNVylgrsiJzkiZQP9qwmaan9auc=' 
WHERE 
  key_id = '7e3b0b443d418bb78ac28f7f9bbf25719a666906cd53e261158c91412c1d4dd3' 
  AND (
    token = '+WI6+3OkkB0pPmNsvNVylgrsiJzkiZQP9qwmaan9auc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025