UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p+2+kVe/xtr87yB7cNANjs1TtIe/sFksvaT76CL8Vgc=' 
WHERE 
  key_id = 'af48f375c584b2bc8c875c9a8f20df8d217f7a02bedcd549531840c6dbed0aa7' 
  AND (
    token = 'p+2+kVe/xtr87yB7cNANjs1TtIe/sFksvaT76CL8Vgc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032