UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kx0oanoe/ORryBZZgFz32EQdVYFWhI9RRtYjDQtitXM=' 
WHERE 
  key_id = '218778d3ab9cd7f94ec95d65756deee52ac3f22f43d245c66678bfdf67d21431' 
  AND (
    token = 'kx0oanoe/ORryBZZgFz32EQdVYFWhI9RRtYjDQtitXM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037