UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vTTfcM1rzPEPn+JQSj5F1MupP2WTRvKFyFB/mPCJioo=' 
WHERE 
  key_id = '3d09a7c1990eff8378657455cd46aba0301bfdbcdeecea23d47ead51c7b9a6d5' 
  AND (
    token = 'vTTfcM1rzPEPn+JQSj5F1MupP2WTRvKFyFB/mPCJioo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053