UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aM4Ew/ihXF23rCgy4HkjW5/ZXoOV9ctE8r9yendHk6Y=' 
WHERE 
  key_id = '38860f584475854af97215a9cfd57cce75bb2816f3a690629dd837a84a7ad72b' 
  AND (
    token = 'aM4Ew/ihXF23rCgy4HkjW5/ZXoOV9ctE8r9yendHk6Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039