UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hh8gica4NVZslbZQYz8ks09mwGqOga/kDRemtgTIXFg=' 
WHERE 
  key_id = '401d84838be8ffdbacc0f0047320e84ade8e727b189955788c7fbe63fbd2eebf' 
  AND (
    token = 'hh8gica4NVZslbZQYz8ks09mwGqOga/kDRemtgTIXFg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031