UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dZwYy4Cc56QaEe1RSK7PCL6png9SzMT+f8f1GWH7iuU=' 
WHERE 
  key_id = '7caed9b48d9e05dae1fac09ca3bce81ebfd68db605c1dfa935fc03d16187ac98' 
  AND (
    token = 'dZwYy4Cc56QaEe1RSK7PCL6png9SzMT+f8f1GWH7iuU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051