UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ppLIEdEXo1etUpqD9Bn6e3UNGxMp1TYeW7pfhQ1I76o=' 
WHERE 
  key_id = 'a9fa213f5769f3309f9377760d9a903de18ddb9bd5474d62803f889829e99314' 
  AND (
    token = 'ppLIEdEXo1etUpqD9Bn6e3UNGxMp1TYeW7pfhQ1I76o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032