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

Query time 0.00042