UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vjae83i/N4vr7rGGfxFElhhlAenNUum61KPxAWEM4c8=' 
WHERE 
  key_id = 'f9d2b4e02413fca8be406beff92ff9d0862402babadaa81364d3e0d8c70da42f' 
  AND (
    token = 'vjae83i/N4vr7rGGfxFElhhlAenNUum61KPxAWEM4c8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021