UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pvSoQzlJFMd7SBT8BIiF00isLM1sidK7boHIHV3uyoE=' 
WHERE 
  key_id = '8583f1bf9dd185577033e22193f18435471722f7beda46b050abd8981dd13f95' 
  AND (
    token = 'pvSoQzlJFMd7SBT8BIiF00isLM1sidK7boHIHV3uyoE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032