UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ririkA40vQYagz/bOtw9Omwplc9y/GMFO5u7pVW374E=' 
WHERE 
  key_id = '1969edfa3c5ce91df70090b65262d83d46f4ad491bd05a0bbc0a6fa84711dabb' 
  AND (
    token = 'ririkA40vQYagz/bOtw9Omwplc9y/GMFO5u7pVW374E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040