UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oyXK93HTQzljna000bKf9UblpgmX+B4+CyrxSVscoAI=' 
WHERE 
  key_id = 'b64822d8fbe683f3ec86dd92ff3e3352ac660ac8cdaf9d653de417de31425b2e' 
  AND (
    token = 'oyXK93HTQzljna000bKf9UblpgmX+B4+CyrxSVscoAI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032