UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B+66HVD3+F8KsxdgqK4X+Lba7RILD410wa/pn3XLA3Y=' 
WHERE 
  key_id = '6d3e681306d24473ffc70b79a6e6531cccae882cc80f442d6d401c0371eeca10' 
  AND (
    token = 'B+66HVD3+F8KsxdgqK4X+Lba7RILD410wa/pn3XLA3Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049