UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nHmUr/F9sEtVpQ2J2x3TOWaqp6Iu7+ja1Idc6zqrpLM=' 
WHERE 
  key_id = '6ae35af679f335121385f2c17fa2dbfd3749077735bf7c6b951a69b4acf814a5' 
  AND (
    token = 'nHmUr/F9sEtVpQ2J2x3TOWaqp6Iu7+ja1Idc6zqrpLM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043