UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 't4k+OieWJd1hAZbGadDhREUTOeq9HVlRT11shTN+RtY=' 
WHERE 
  key_id = 'a548efcd9722dad9f2ab123490bab3af19b02b660389e88011fe235dc352a9ba' 
  AND (
    token = 't4k+OieWJd1hAZbGadDhREUTOeq9HVlRT11shTN+RtY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043